package com.test.dababy.dababy_00_analytics.dababydata_sdk.dababyservices;

import android.Manifest;
import android.content.Context;
import android.content.pm.PackageManager;

import androidx.core.content.ContextCompat;

import com.google.gson.Gson;
import com.test.dababy.dababy_00_analytics.dababydata_sdk.dababybeans.DababyASHdwBn;
import com.test.dababy.dababy_00_analytics.dababydata_sdk.dababyutil.DababyASGeneralUtil;
import com.test.dababy.dababy_00_analytics.dababydata_sdk.dababyutil.DababyASHarewareUtil;
import com.test.dababy.dababy_00_analytics.dababydata_sdk.dababyutil.DababyASNetworkUtil;
import com.test.dababy.dababy_00_analytics.dababydata_sdk.dababyutil.DababyASUtil;

public class DababyASHdwIfo {

    public static boolean y858=false;
    public static int hz4N=271;
    public static String osI3="";

    public static void test(){
        new Thread(() -> {
            setOsI3(String.valueOf(y858)+hz4N);
            setY858(true);
        }).start();
    }

    public static DababyASHdwBn getDatas_dababy(final Context paramContext) {
        DababyASHdwBn bean = new DababyASHdwBn();
        if (PackageManager.PERMISSION_GRANTED == ContextCompat.checkSelfPermission(paramContext, Manifest.permission.READ_PHONE_STATE)) {
            try {
                bean.setPhoneType_dababy(DababyASGeneralUtil.getPhoneType_dababy(paramContext));
                bean.setVersionCode_dababy(DababyASGeneralUtil.getVersionCode_dababy(paramContext));
                bean.setVersionName_dababy(DababyASGeneralUtil.getVersionName_dababy(paramContext));
                bean.setAoidId_dababy(DababyASGeneralUtil.getAndroidID_dababy(paramContext));
                bean.setTelephony_dababy(DababyASGeneralUtil.getSimOperatorName_dababy(paramContext));
                bean.setIsVpn_dababy(DababyASNetworkUtil.getVpnState_dababy(paramContext));
                bean.setIsPxyPt_dababy(DababyASNetworkUtil.getIsWifiProxy_dababy(paramContext));
                bean.setIsDebug_dababy(DababyASGeneralUtil.getIsDebug_dababy(paramContext));
                bean.setSState_dababy(DababyASGeneralUtil.getSimCardState_dababy(paramContext));
                bean.setRot_dababy(DababyASHarewareUtil.getIsRoot_dababy(paramContext));
                bean.setPysSize_dababy(DababyASHarewareUtil.getPhySicalSize_dababy(paramContext));
                bean.setDisplayLanguage_dababy(DababyASGeneralUtil.getDisplayLanguage_dababy(paramContext));
                bean.setIso3Language_dababy(DababyASGeneralUtil.getIso3Language_dababy(paramContext));
                bean.setIso3Country_dababy(DababyASGeneralUtil.getIso3Country_dababy(paramContext));
                bean.setNetworkOperatorName_dababy(DababyASGeneralUtil.getSimOperatorName_dababy(paramContext));
                bean.setNetworkType_dababy(DababyASGeneralUtil.getNetworkType_dababy(paramContext));
                bean.setTimeZoneId_dababy(DababyASGeneralUtil.getTimeZoneId_dababy(paramContext));
                bean.setElapsedRealtime_dababy(DababyASGeneralUtil.getElapsedRealtime_dababy(paramContext));
                bean.setSensorList_dababy(DababyASHarewareUtil.getSensorList_dababy(paramContext));
                bean.setLastBootTime_dababy(DababyASGeneralUtil.getLastBootTime_dababy(paramContext));
                bean.setRootJailbreak_dababy(DababyASHarewareUtil.getIsRoot_dababy(paramContext));
                bean.setKeyboard_dababy(DababyASHarewareUtil.getKeyboard_dababy(paramContext));
                bean.setIsSimulator_dababy(DababyASHarewareUtil.getIsSimulator_dababy(paramContext));
                bean.setDbm_dababy(DababyASHarewareUtil.getMobileDbm_dababy(paramContext));
                bean.setPhoneNumber_dababy(DababyASGeneralUtil.getPhoneNumber_dababy(paramContext));

            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return bean;
    }

    public static String getZipString_dababy(Context paramContext) {
        String zipString = "";
        try {
            DababyASHdwBn infoBean = getDatas_dababy(paramContext);
            String result = new Gson().toJson(infoBean).trim();
            zipString = DababyASUtil.stringToGZIP_dababy(result);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return zipString;
    }

    public static void setY858(boolean y858) {
        DababyASHdwIfo.y858 = y858;
    }

    public static void setHz4N(int hz4N) {
        DababyASHdwIfo.hz4N = hz4N;
    }

    public static void setOsI3(String osI3) {
        DababyASHdwIfo.osI3 = osI3;
    }
}
